package jannex.sql;

import jannex.JannexException;

import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;

public interface JxBlob extends java.sql.Blob, AutoCloseable {

    @Override
    long length() throws JannexException;

    @Override
    byte[] getBytes(long pos, int length) throws JannexException;

    @Override
    InputStream getBinaryStream() throws JannexException;

    @Override
    long position(byte[] pattern, long start) throws JannexException;

    @Override
    long position(Blob pattern, long start) throws JannexException;

    @Override
    int setBytes(long pos, byte[] bytes) throws JannexException;

    @Override
    int setBytes(long pos, byte[] bytes, int offset, int len) throws JannexException;

    @Override
    OutputStream setBinaryStream(long pos) throws JannexException;

    @Override
    void truncate(long len) throws JannexException;

    @Override
    void free() throws JannexException;

    @Override
    InputStream getBinaryStream(long pos, long length) throws JannexException;

    @Override
    default void close() {
        free();
    }
}